import config, { baseUrl } from '@/config'
import RequestBase from '@/utils/request.js'

const request = new RequestBase(config.baseUrl)
const specialWorkRequest = new RequestBase(config.specialWorkUrl)
/**
 * @description 获取流程配置列表
 */
export function queryWorkflowList(params) {
  return request.get('/activiti/list', {
    params
  })
}

/**
 * 添加流程配置
 */
export function createWorkflow(data) {
  return request.post('/activiti/add', data)
}

/**
 * 编辑流程配置
 */
export function updateWorkflow(data) {
  return request.put('/activiti/edit', data)
}

/**
 * 获取流程配置详情
 */
export function getActivityByType(defType, businessType) {
  return request.get(`/activiti/query/${defType}/${businessType}`)
}

/**
 * 获取流程配置详情
 */
export function getActivitiById(procDefId) {
  return request.get(`/activiti/query/${procDefId}`)
}

/**
 * 删除流程配置
 */
export function deleteActiviti(procDefId) {
  return request.delete(`/activiti/delete/${procDefId}`)
}

/**
 * 获取工作流所有节点
 */
export function getActivitiNodeAttrs(procDefId) {
  return request.get(`/activiti/flow-config/node/${procDefId}`)
}

/**
 * 获取模版节点所有人的配置信息
 */
export function getWorkflowTemplateNodesById(templateId) {
  return request.get(`/basic-info/activiti/flow-template/nodes/${templateId}`)
}
/**
 * 获取作业流程模版
 */
export function getWorkflowTemplate(query) {
  return request.get('/basic-info/activiti/flow-template/query', query)
}
